<?php


namespace RedMVC\Form\Validator;

/**
 * InArray class
 *  
 * @category    RedMVC
 * @package     Form
 * @subpackage  Validator 
 * @author      Jan Fischer, bitWorking <info@bitworking.de>
 */
class InArray extends AValidator{
    
    private $values = null;
    
    public function __construct(array $values){
        $this->values = $values;
    }

    public function isValid($value, $formValues = null){
        if(!in_array($value, $this->values)){
            $this->setError('FORM_VALIDATOR_INARRAY', $value);
            return false;
        }
        return true;
    }
}